import * as Types from '../action-types';
import chalk from 'chalk';
const log = console.log;
const init = {
    up:1,
    down:1
}
export  default function VoteReducer(state = init, action) {
    switch (action.type) {
        case Types.VOTE_UP:
            log(chalk.green("Up votes:", action.payload));
            return {
                ...state,up:state.up+1
            }
        case Types.VOTE_DOWN:
            return {
                ...state,down:state.down+1,
            }
    }
    return state;
}